import React, { Component } from "react";
import { Button, message } from "antd";
import timeDay from "../data";

class BtmBtn extends Component {
  handleAudit = () => {
    const { dispatch, planId, checked } = this.props;
    if (checked.length > 0) {
      dispatch({
        type: "",
        payload: { planState: checked[0], planId }
      });
    } else {
      message.error("请勾选审批状态");
    }
  };

  render() {
    const { collapsed } = this.props;
    const saves = "save";
    const submits = "submit";
    return (
      <div>
        <div
          style={{
            width: collapsed ? "calc(100% - 66px)" : "calc(100% - 202px)",
            ...timeDay.styleBtn
          }}
        >
          <Button onClick={this.props.onBack}>取消</Button>
          <Button
            style={{ marginLeft: 8, marginRight: 8 }}
            onClick={e => this.props.handleSearch(e, saves)}
            htmlType="submit"
          >
            保存
          </Button>
          <Button
            type="primary"
            style={{ marginRight: 16 }}
            onClick={e => this.props.handleSearch(e, submits)}
            htmlType="submit"
          >
            申请发布
          </Button>
        </div>
      </div>
    );
  }
}

export default BtmBtn;
